package org.xw.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseUtil {
    private Integer code;
    private String msg;
    private Object data;


    public static ResponseUtil success(Object data) {
        ResponseUtil responseUtil = new ResponseUtil();
        responseUtil.code = 1;
        responseUtil.msg = "操作成功";
        responseUtil.data = data;
        return responseUtil;
    }


    public static ResponseUtil error(String msg) {
        ResponseUtil responseUtil = new ResponseUtil();
        responseUtil.code = 2;
        responseUtil.msg = msg;
        return responseUtil;
    }
}
